import Vue from "vue";
import VueRouter from "vue-router";
Vue.use(VueRouter);

const routes = [
  {
    path: "/home",
    name: "Home",
    component: () => import(/* webpackChunkName: "about" */ "../views/Home.vue"),
    children:[
      {   // 工作台
        path: '/workplace',
        name: 'workplace',
        component: () => import('@/views/workplace/workplace.vue')
      },
      {   // 仪表盘 >> 欢迎页
        path: '/dashboard/welcome',
        name: 'welcome',
        component: () => import('@/views/dashboard/welcome.vue')
      },
      {   // 个人页 >> 个人中心
        path: '/account/center',
        name: 'center',
        component: () => import('@/views/account/center.vue')
      },
      {   // 个人页 >> 个人设置
        path: '/account/settings',
        name: 'settings',
        component: () => import('@/views/account/settings.vue'),
		children:[
			{   // 个人页 >> 个人设置 >> 基础设置
			  path: '/account/settings/base',
			  name: 'base',
			  component: () => import('@/views/account/setModel/base.vue')
			},
			{   // 个人页 >> 个人设置 >> 安全设置
			  path: '/account/settings/security',
			  name: 'security',
			  component: () => import('@/views/account/setModel/security.vue')
			},
			{   // 个人页 >> 个人设置 >> 个性化
			  path: '/account/settings/custom',
			  name: 'custom',
			  component: () => import('@/views/account/setModel/custom.vue')
			},
			{   // 个人页 >> 个人设置 >> 账户绑定
			  path: '/account/settings/binding',
			  name: 'binding',
			  component: () => import('@/views/account/setModel/binding.vue')
			},
			{   // 个人页 >> 个人设置 >> 新消息通知
			  path: '/account/settings/notification',
			  name: 'notification',
			  component: () => import('@/views/account/setModel/notification.vue')
			},
		]
      },
	  {   // 组件展示 >> 按钮
	    path: '/moduleShow/butt',
	    name: 'butt',
	    component: () => import('@/views/moduleShow/butt.vue')
	  },
	  {   // 组件展示 >> 输入框
	    path: '/moduleShow/inputShow',
	    name: 'inputShow',
	    component: () => import('@/views/moduleShow/inputShow.vue')
	  },
	  {   // 组件展示 >> 评分
	    path: '/moduleShow/gradeStar',
	    name: 'gradeStar',
	    component: () => import('@/views/moduleShow/gradeStar.vue')
	  },
	  {   // 刷新页
	    path: '/refresh',
	    name: 'refresh',
	    component: () => import('@/views/Refresh.vue')
	  }
    ]
  },
  {
    path: "/",
    name: "login",
    component: () => import("../views/login.vue"),
  },
];

// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
